#pragma once

#include "SDL2/SDL.h"
#include <memory>
#include "Earth.hpp"
#include "FileHandler.hpp"
#include "InputHandler.hpp"

_NNU_DGGS_BEGIN
namespace DGGSViewer {

// 前向声明
class PerformanceMonitor;

class Application {
public:
    Application();
    ~Application();
    
    int run();
    void handleFileOpen() const;
    void handleMultipleFilesOpen() const;

private:
    bool initialize();
    void cleanup() const;
    void render();
    void processEvents();
    void toggleFullscreen();
    void handleWindowResize(int width, int height) const;
    
    bool m_running;
    SDL_Window* m_window;
    SDL_Renderer* m_renderer;
    SDL_GLContext m_glContext;
    
    std::unique_ptr<Earth> m_earth;
    std::unique_ptr<FileHandler> m_fileHandler;
    std::unique_ptr<InputHandler> m_inputHandler;
    
    int m_windowWidth;
    int m_windowHeight;
    bool m_isFullscreen;
    
    // 鼠标事件处理相关变量
    bool m_mouseLeftDown;
    int m_mouseLastX;
    int m_mouseLastY;
};

}
_NNU_DGGS_END